/*
The MIT License (MIT)

Copyright (c) 2013 Mike Dapiran, Brian May, Richard Pospesel, and Bert Wierenga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software 
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once

#include "hhdIComponent.h"
#include "hhdMatrix4.h"
#include "hhdPair.hpp"
#include "hhdVector2.h"
#include "hhdVector3.h"
#include "hhdVector4.h"

#include "hhdRegistry.h"

namespace hhd
{
	/**
	* This class represents a camera for rendering. There is one camera mainly used for rendering. The
	* last registered Camera in the Scene is the one used as main. If you have more than one Camera
	* in a Scene then you will likely need to use gameplay logic to set the active camera in the 
	* DX11Director to be the one you would like.
	* 
	* @author Bert Wierenga
	*/
	class CCamera : public IComponent
	{
		ComponentH(hhd::CCamera, CCamera);
		HHD_REGISTRANT_H(IComponent, CCamera);

	public:
		CCamera(void);
		~CCamera(void);
			
		void initialize();

		//Return the view matrix
		const Matrix4& getView();
		const Matrix4& getProjection();

		//Return the position of the camera object.
		Vector4 getPosition();

		//get the forward, up, and right of the camera
		Vector3 getForward();
		Vector3 getUp();
		Vector3 getRight();

		Pair<Vector3, Vector3> getMouseRay(Vector2 in_mouse_coordinates);

	private:

		//the view matrix which is used to render the scene with this camera
		Matrix4 _view;

		//the projection matrix for this camera
		Matrix4 _projection;

		//data read in to construct projection matrix
		// field of view is the horizontal field of view
		float _field_of_view_degrees;
		float _field_of_view_radians;
		float _aspect_ratio;
		float _near_clip;
		float _far_clip;
		bool _orthographic;
		float _orthographic_width;

		bool _game_camera;//this makes it the camera we use to render the scene
		
	};
}